# -*- coding: utf-8 -*-
"""
created on 2017/12/7 14:47

@author: didichen
"""

# http://www.pythonchallenge.com/pc/def/linkedlist.php
# http://www.pythonchallenge.com/pc/def/peak.html

import requests
import re
try:
    webpage = requests.get("http://www.pythonchallenge.com/pc/def/linkedlist.php?nothing=8022")
    while True:
        text = webpage.text
        nextnumber = re.findall(r'and the next nothing is ([0-9]+)', text, re.IGNORECASE)
        print(nextnumber)
        webpage = requests.get("http://www.pythonchallenge.com/pc/def/linkedlist.php?nothing=" + nextnumber[0])
except:
    print(text)
